package morenoapp.components.common.table.renderer;

import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Рендерер ячеек таблицы с тултипом.
 * @author dmitry.mamonov
 */
public class TooltipDefaultTableCellRenderer extends DefaultTableCellRenderer {
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        if (value != null && !"".equals(value) && !"<html>".equals(value)) { //NOI18N
            setToolTipText(value.toString());
        } else {
            setToolTipText(null);
        }
        return this;
    }
}
